diff -Naur OpenShadingLanguage-Release-1.9.9/src/cmake/flexbison.cmake external_osl/src/cmake/flexbison.cmake
--- OpenShadingLanguage-Release-1.9.9/src/cmake/flexbison.cmake	2018-05-01 16:39:02 -0600
+++ external_osl/src/cmake/flexbison.cmake	2018-08-23 15:42:27 -0600
@@ -77,7 +77,7 @@
           DEPENDS ${${compiler_headers}}
           WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} )
         ADD_CUSTOM_COMMAND ( OUTPUT ${flexoutputcxx} 
-          COMMAND ${FLEX_EXECUTABLE} -o ${flexoutputcxx} "${CMAKE_CURRENT_SOURCE_DIR}/${flexsrc}"
+          COMMAND ${FLEX_EXECUTABLE} ${FLEX_EXTRA_OPTIONS} -o ${flexoutputcxx} "${CMAKE_CURRENT_SOURCE_DIR}/${flexsrc}"
           MAIN_DEPENDENCY ${flexsrc}
           DEPENDS ${${compiler_headers}}
           WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} )
diff -Naur OpenShadingLanguage-Release-1.9.9/src/cmake/flexbison.cmake.rej external_osl/src/cmake/flexbison.cmake.rej
--- OpenShadingLanguage-Release-1.9.9/src/cmake/flexbison.cmake.rej	1969-12-31 17:00:00 -0700
+++ external_osl/src/cmake/flexbison.cmake.rej	2018-08-24 17:42:11 -0600
@@ -0,0 +1,11 @@
+--- src/cmake/flexbison.cmake	2018-05-01 16:39:02 -0600
++++ src/cmake/flexbison.cmake	2018-08-24 10:24:03 -0600
+@@ -77,7 +77,7 @@
+           DEPENDS ${${compiler_headers}}
+           WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} )
+         ADD_CUSTOM_COMMAND ( OUTPUT ${flexoutputcxx} 
+-          COMMAND ${FLEX_EXECUTABLE} -o ${flexoutputcxx} "${CMAKE_CURRENT_SOURCE_DIR}/${flexsrc}"
++          COMMAND ${FLEX_EXECUTABLE} ${FLEX_EXTRA_OPTIONS} -o ${flexoutputcxx} "${CMAKE_CURRENT_SOURCE_DIR}/${flexsrc}"
+           MAIN_DEPENDENCY ${flexsrc}
+           DEPENDS ${${compiler_headers}}
+           WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} )
diff -Naur OpenShadingLanguage-Release-1.9.9/src/include/OSL/llvm_util.h external_osl/src/include/OSL/llvm_util.h
--- OpenShadingLanguage-Release-1.9.9/src/include/OSL/llvm_util.h	2018-05-01 16:39:02 -0600
+++ external_osl/src/include/OSL/llvm_util.h	2018-08-25 14:05:00 -0600
@@ -33,6 +33,8 @@
 
 #include <vector>
 
+#define OSL_HAS_BLENDER_CLEANUP_FIX
+
 #ifdef LLVM_NAMESPACE
 namespace llvm = LLVM_NAMESPACE;
 #endif
@@ -487,6 +489,7 @@
     std::string func_name (llvm::Function *f);
 
     static size_t total_jit_memory_held ();
+    static void Cleanup ();
 
 private:
     class MemoryManager;
diff -Naur OpenShadingLanguage-Release-1.9.9/src/include/OSL/oslnoise.h external_osl/src/include/OSL/oslnoise.h
--- OpenShadingLanguage-Release-1.9.9/src/include/OSL/oslnoise.h	2018-05-01 16:39:02 -0600
+++ external_osl/src/include/OSL/oslnoise.h	2018-08-24 17:42:11 -0600
@@ -762,7 +762,7 @@
 // packed into a float4. We assume T is float and VECTYPE is float4,
 // but it also works if T is Dual2<float> and VECTYPE is Dual2<float4>.
 template<typename T, typename VECTYPE>
-OIIO_FORCEINLINE T bilerp (VECTYPE abcd, T u, T v) {
+OIIO_FORCEINLINE T bilerp (VECTYPE& abcd, T u, T v) {
     VECTYPE xx = OIIO::lerp (abcd, OIIO::simd::shuffle<1,1,3,3>(abcd), u);
     return OIIO::simd::extract<0>(OIIO::lerp (xx,OIIO::simd::shuffle<2>(xx), v));
 }
diff -Naur OpenShadingLanguage-Release-1.9.9/src/liboslexec/llvm_util.cpp external_osl/src/liboslexec/llvm_util.cpp
--- OpenShadingLanguage-Release-1.9.9/src/liboslexec/llvm_util.cpp	2018-05-01 16:39:02 -0600
+++ external_osl/src/liboslexec/llvm_util.cpp	2018-08-25 14:04:27 -0600
@@ -140,7 +140,10 @@
 };
 
 
-
+void LLVM_Util::Cleanup ()
+{
+       jitmm_hold.clear();
+}
 
 size_t
 LLVM_Util::total_jit_memory_held ()
